翻訳と辞書
Words near each other
・ aleph 0
・ alert
・ alex
・ alexis
・ alf
・ alfl
・ algebra
・ algebra of communicating processes
・ algebraic
・ algebraic compiler and translator
algebraic data type
・ algebraic interpretive dialogue
・ algebraic logic functional language
・ algebraic manipulation package
・ algebraic specification language
・ algebraic structure
・ algol
・ algol 58
・ algol 60
・ algol 60 modified


Dictionary Lists
翻訳と辞書 辞書検索 [ 開発暫定版 ]
スポンサード リンク

algebraic data type : FOLDOC
algebraic data type
(Or "sum of products type") In functional programming, new types can be defined, each of which has one or more {constructors}. Such a type is known as an algebraic data type. E.g. in Haskell we can define a new type, "Tree":
data Tree = Empty | Leaf Int | Node Tree Tree

with constructors "Empty", "Leaf" and "Node". The constructors can be used much like functions in that they can be (partially) applied to arguments of the appropriate type. For example, the Leaf constructor has the functional type Int -> Tree.
A constructor application cannot be reduced (evaluated) like a function application though since it is already in normal form. Functions which operate on algebraic data types can be defined using pattern matching:
depth :: Tree -> Int
depth Empty = 0
depth (Leaf n) = 1
depth (Node l r) = 1 + max (depth l) (depth r)

The most common algebraic data type is the list which has constructors Nil and


スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース

Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.